{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1f2096db",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8ac24e87",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bdb7f42d",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "09c9095e",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "d0541ecd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(300, 512, 640)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "data = np.load(\"inference_results/clearpose/set2#scene6/set2_scene6_depth.npz\")\n",
    "\n",
    "\n",
    "data['depth'].shape\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "97d3dff8",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "import cv2\n",
    "import os\n",
    "\n",
    "\n",
    "from daniel_tools.img_utils import colorize_depth_map,concat_images, imgs2video2, disparity2depth\n",
    "import numpy as np\n",
    "mp4_path = \"/baai-cwm-vepfs/cwm/shaocong.xu/exp/DepthCrafter/inference_results/pics/cluster_bg/cluster_bg_depth.npz\"\n",
    "data = np.load(mp4_path)['depth']\n",
    "\n",
    "from os.path import join, dirname\n",
    "\n",
    "target_dir = join(dirname(mp4_path), 'depths')\n",
    "os.makedirs(target_dir, exist_ok=True)\n",
    "\n",
    "\n",
    "\n",
    "for idx,x in enumerate(data):\n",
    "\n",
    "    x = colorize_depth_map(x)\n",
    "\n",
    "    x.save(join(target_dir, f\"{idx:06d}.png\"))\n",
    "    \n",
    " \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a0c59b34",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "48239480",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "18368d18",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
